<template>
	<view>
		 <gwbq-calendar 
		    :insert="true"
		    :lunar="true" 
				@change="onChange"
		/>
		<view class="huangli">
			<view class="date">
				{{info.LMonth}}{{info.LDay}}
			</view>
			<view class="text">
				{{info.ShenWei}}
			</view>
			<view class="text">
			  <span style="color: #AB3E2D;padding-right: 5px;">宜 </span>	{{info.Yi}}
			</view>
			<view class="text">
			  <span style="color: #639257;padding-right: 5px;">忌 </span>	{{info.Ji}}
			</view>
		</view>
	</view>
</template>

<script>
import { formatDay } from '../../../static/utils';
	export default {
		data() {
			return {
				info:{}
			}
		},
		onShow() {
			let date = formatDay(new Date())
			this.getHl(date)
		},
		methods: {
			onChange(e){
				console.log(e);
				this.getHl(e.fulldate)
			},
			getHl(date){
				let data = {
					sun:date
				}
				uni.request({
					url: 'https://www.36jxs.com/api/Commonweal/almanac',
					data: data,
					success: (res) => {
						console.log(res);
						this.info = res.data.data || {}
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
.huangli{
	padding: 20rpx;
	box-sizing: border-box;
	.date{
		color: #e43d33;
		font-size: 40rpx;
		font-weight: 600;
		padding-bottom: 10rpx;
	}
	.text{
		color: #656565;
		padding: 6rpx 0;
	}
}
</style>
